package com.qingxin.sys.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;

/**
 * 角色权限
 * @author Administrator
 *
 */
@Entity
@Table(name = "sys_role_rights")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class SysRoleRights extends BaseEntity implements java.io.Serializable {
	private static final long serialVersionUID = -2624360364086708930L;

	private String rightid;
	private SysRole sysRole;
	private SysPermission sysPermission;
	private String create_by;
	private Date create_time;
	
	public SysRoleRights() {
	}
	
	
	public SysRoleRights(SysRole sysRole, SysPermission sysPermission,
			String create_by, Date create_time) {
		this.sysRole = sysRole;
		this.sysPermission = sysPermission;
		this.create_by = create_by;
		this.create_time = create_time;
	}


	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "rightid", unique = true, nullable = false, length = 32)
	public String getRightid() {
		return rightid;
	}
	public void setRightid(String rightid) {
		this.rightid = rightid;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "roleid")
	public SysRole getSysRole() {
		return sysRole;
	}
	public void setSysRole(SysRole sysRole) {
		this.sysRole = sysRole;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "perid")
	public SysPermission getSysPermission() {
		return sysPermission;
	}
	public void setSysPermission(SysPermission sysPermission) {
		this.sysPermission = sysPermission;
	}
	
	@Column(name = "create_by", length = 50)
	public String getCreate_by() {
		return create_by;
	}
	public void setCreate_by(String create_by) {
		this.create_by = create_by;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreate_time() {
		return create_time;
	}
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	
	
}
